import { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import equipRepair_APi from "../equipRepair";

/*
 * @Descripttion:设备备件管理接口
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-12 20:33:18
 */
export default class equipSpare_APi extends equipRepair_APi {
  //#region 设备备件台账

  /**
   * @Author: xzh
   * @Descripttion:保存设备备件台账信息
   * @Param:
   * @param {object} data
   */
  static saveEquipSpareLedger = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/SparePartLedger/SaveSparePartLedger",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备备件台账信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipSpareLedger = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/SparePartLedger/DeleteSparePartLedger",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备备件台账信息
   * @Param:
   * @param {number} id 设备备件台账主键
   */
  static getEquipSpareLedgerInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/SparePartLedger/GetSparePartLedger",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备备件台账列表
   * @Param:
   */
  static getEquipSpareLedgerPageList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/SparePartLedger/GetSparePartLedgerPageList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 设备备件类型

  /**
   * @Author: xzh
   * @Descripttion:保存设备备件类型信息
   * @Param:
   * @param {object} data
   */
  static saveEquipSpareType = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/SparePartType/SaveSparePartType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备备件类型信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipSpareType = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/SparePartType/DeleteSparePartType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改设备备件类型状态
   * @Param:
   * @param {Array} data
   */
  static updateEquipSpareTypeStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/SparePartType/UpdateSparePartTypeStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备备件类型信息
   * @Param:
   * @param {number} id 设备备件类型主键
   */
  static getEquipSpareTypeInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/SparePartType/GetSparePartType",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备备件类型列表
   * @Param:
   */
  static getEquipSpareTypeList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/SparePartType/GetSparePartTypeList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion

  //#region 入库管理

  /**
   * @Author: xzh
   * @Descripttion:保存入库信息
   * @Param:
   * @param {object} data
   */
  static saveEquipInBound = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockIn/SaveSparePartStockIn",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除入库信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipInBound = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockIn/DeleteSparePartStockIn",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取入库信息
   * @Param:
   * @param {number} id 入库主键
   */
  static getEquipInBoundInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockIn/GetSparePartStockIn",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取入库列表
   * @Param:
   */
  static getInEquipBoundList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockIn/GetSparePartStockInPageList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion

  //#region 出库管理

  /**
   * @Author: xzh
   * @Descripttion:保存出库信息
   * @Param:
   * @param {object} data
   */
  static saveEquipOutBound = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockOut/SaveSparePartStockOut",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除出库信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipOutBound = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockOut/DeleteSparePartStockOut",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取出库信息
   * @Param:
   * @param {number} id 出库主键
   */
  static getEquipOutBoundInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockOut/GetSparePartStockOut",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取出库列表
   * @Param:
   */
  static getEquipOutBoundList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/SparePartStockOut/GetSparePartStockOutPageList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion
}
